<template>
  <div>
     <keep-alive v-if="true">
      <component :is="component" :rid="rid" />
     </keep-alive>
  </div>
</template>

<script>
import ResearchView from '../components/Research/ResearchView.vue'
import Overview from '../components/Research/Overview.vue'



export default {
  components: { 
    "Rtrue":Overview,
    "Rfalse":ResearchView, 
  },
  data() {
    return {
      component: "Rtrue",
      rid: "0",
    };
  },
  created() {
    if(this.$route.query) 
    {
      this.init();

    }
  },
  watch: {
    //监听路由是否变化
    '$route' (to, from) { 
      if(to.query.rid != from.query.rid){
        this.init();
      }
    }
  },
  methods: {
    init() {
      this.component = "R"+(this.$route.query.rid == "0");
      this.rid = this.$route.query.rid;
      console.log(this.component)
    },
  }

  
}
</script>

<style>

</style>
